package com.kfm.mvn.listener;

import com.kfm.mvn.util.Constant;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSession;
import java.util.concurrent.ConcurrentHashMap;

@WebListener
public class MyServletContextListener implements ServletContextListener {

    @Override
    public void contextInitialized(ServletContextEvent sce) {
        ConcurrentHashMap<String, HttpSession> map = new ConcurrentHashMap<>();
        sce.getServletContext().setAttribute(Constant.ONLINE_USERS_KEY, map);
    }

}
